package reference;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author LiuYan
 * @date 2021/11/18 10:32
 * 构造器引用：类::new
 * 注意：需要调用的构造器的参数列表要与函数式接口中抽象方法的参数列表保持一致
 * 数组引用：
 * Type[]::new;
 *
 */
public class Part04 {
    public static void main(String[] args) {

        Supplier<Student> supplier = Student::new;
        System.out.println(supplier.get());

        BiFunction<Integer, String, Student> studentBiFunction = Student::new;
        System.out.println(studentBiFunction.apply(18, "ly"));

        // 数组引用
        Function<Integer,String[]>function=String[]::new;
        System.out.println(function.apply(20).length);

    }


}
